package com.zj.study.utils.validation.validator.length;


import com.zj.study.utils.validation.annotation.ValidateSupport;
import com.zj.study.utils.validation.annotation.constraint.Length;
import org.springframework.lang.NonNull;

/**
 * @author 谭耀飞
 * @since 2020.12.0
 */
@ValidateSupport(String.class)
public class LengthValidatorForString extends AbstractLengthValidator<String> {

  @Override
  boolean compare(@NonNull Length length, String value) {
    return length.min() <= value.length() && value.length() <= length.max();
  }
}
